/**
 * 配置后台请求地址（正式环境）
 * @return {[type]} [str]
 */
jQuery.httpRootPath = function () {
    return "http://csm.haois.me/data";
//	 return "http://127.0.0.1:8025/mpDataBase";
//	return "http://127.0.0.1:8025/local8090";
}
/**
 * 配置后台请求地址(测试环境)
 * @return {[type]} [str]
 */
jQuery.testRootPath = function () {
	  return "http://127.0.0.1:8020/mpDataBase/";
};
/**
 * 根据参数获取值
 * @param {Object} name
 */
function GetQueryString(name){
     var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
     var r = window.location.search.substr(1).match(reg);
     if(r!=null){
     	return unescape(r[2]);
     } 
     return null;
}
/**
 * 获取app登录状态
 */
jQuery.appSignState = function  () {
	var data="";
	$.ajax({
		url: $.httpRootPath() + '/api/app/log/logState',
		type: 'GET',
		dataType: 'json',
		timeout: 15000,
		async: false,
		success: function(reply) {
			console.log("返回码:"+reply.code + "返回信息:" + reply.msg);
			data = {
				code:reply.code,
				msg:reply.msg
			}
		},
		error: function(e) {
			layer.msg("未知错误", {icon: 0});
			data ={
				code:'10',
				msg:'系统异常，请联系开发者'
			}
		}
	});
	return data;
};
/**
 * 获取web登录状态
 */
jQuery.webSignState = function(){
	var data="";
	$.ajax({
		url: $.httpRootPath() + '/api/web/log/logState',
		type: 'GET',
		dataType: 'json',
		timeout: 15000,
		async: false,
		success: function(reply) {
			console.log("返回码:"+reply.code + "返回信息:" + reply.msg)
			data = {
				code:reply.code,
				msg:reply.msg
			}
		},
		error: function(e) {
			layer.msg("未知错误", {icon: 0});
			data ={
				code:'10',
				msg:'系统异常，请联系开发者'
			}
		}
	});
	return data;
};

